package com.nightsoul.logback.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogbackTestServlet extends HttpServlet {
	private static final Logger LOGGER = LoggerFactory.getLogger(LogbackTestServlet.class);

	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		LOGGER.trace("trace info");
		LOGGER.debug("debug info");
		LOGGER.info("info info");
		LOGGER.warn("warn info");
		LOGGER.error("error info", new UnsupportedOperationException("不支持的方法"));
		
		resp.setContentType("text/html; charset=UTF-8");
		resp.getWriter().write("Logback Test");
	}
}
